function addMaj(){
	var v=document.getElementById('maj').insertRow(document.getElementById('maj').rows.length-1);
	var w=v.insertCell(0);
	var x=v.insertCell(1);
	var y=v.insertCell(2);
	var z=v.insertCell(3);
	var u=v.insertCell(4);
	w.innerHTML="<li>Name</li>";
	x.innerHTML="<input name=\"majName"+(((document.getElementById('maj').rows.length-1+2)/3)-1)+"\" type=\"text\">";
	y.innerHTML="Percentage";
	z.innerHTML="<input name=\"majPer"+(((document.getElementById('maj').rows.length-1+2)/3)-1)+"\" type=\"text\">";
	u.innerHTML="<input type=\"button\" value=\"Remove\" onclick=\"remMaj("+(((document.getElementById('maj').rows.length-1+2)/3)-1)+")\">";
	var c=document.getElementById('maj').insertRow(document.getElementById('maj').rows.length-1);
	var d=c.insertCell(0);
	d.innerHTML="<li>Minor Requirements <input type=\"button\" onclick=\"addMin("+(((document.getElementById('maj').rows.length-1+1)/3)-1)+")\" value=\"Add more\"></li>";
	d=document.getElementById('maj').rows[document.getElementById('maj').rows.length-2].cells;
	d[0].colSpan="4";
	var a=document.getElementById('maj').insertRow(document.getElementById('maj').rows.length-1);
	var b=a.insertCell(0);
	b.innerHTML="<table id=\"min"+(((document.getElementById('maj').rows.length-1)/3)-1)+"\"><tr>"
				 +"<td><ul><li>Name</li></ul></td>"
				 +"<td><input name=\"minName"+(((document.getElementById('maj').rows.length-1)/3)-1)+"0\" type=\"text\"></td>"
				 +"<td>Max Raw Score</td>"
				 +"<td><input name=\"minSco"+(((document.getElementById('maj').rows.length-1)/3)-1)+"0\" type=\"text\"></td>"
				 +"</tr></table>";
	b=document.getElementById('maj').rows[document.getElementById('maj').rows.length-2].cells;
	b[0].colSpan="4";
	e=document.getElementById('maj').rows[document.getElementById('maj').rows.length-4].cells;
	e[4].rowSpan="3";
	e=document.getElementById('maj').rows[document.getElementById('maj').rows.length-1].cells;
	e[0].colSpan="5";
}

function addMin(major){
	var v=document.getElementById('min'+major).insertRow(document.getElementById('min'+major).rows.length);
	var w=v.insertCell(0);
	var x=v.insertCell(1);
	var y=v.insertCell(2);
	var z=v.insertCell(3);
	var u=v.insertCell(4);
	w.innerHTML="<ul><li>Name</li></ul>";
	x.innerHTML="<input name=\"minName"+major+(document.getElementById('min'+major).rows.length-1)+"\" type=\"text\">";
	y.innerHTML="Max Raw Score";
	z.innerHTML="<input name=\"minSco"+major+(document.getElementById('min'+major).rows.length-1)+"\" type=\"text\">";
	u.innerHTML="<input type=\"button\" value=\"Remove\" onclick=\"remMin("+major+","+(document.getElementById('min'+major).rows.length-1)+")\">";
}

function remMaj(major){
	var v=document.getElementById('maj').rows[major*3].cells;
	var w=document.getElementById('maj').rows[(major*3)+1].cells;
	var x=document.getElementById('maj').rows[(major*3)+2].cells;
	v[0].style.display = "none";
	v[1].style.display = "none";
	v[2].style.display = "none";
	v[3].style.display = "none";
	v[4].style.display = "none";
	w[0].style.display = "none";
	x[0].style.display = "none";
	temp = 'majName'+major;
	a=document.getElementsByName(temp);
	a[0].value="~NULL";
	temp = 'majPer'+major;
	a=document.getElementsByName(temp);
	a[0].value="~NULL";
	for(i=0;;i++){
		temp = 'minName'+major+i;
		a=document.getElementsByName(temp);
		temp2 = 'minSco'+major+i;
		b=document.getElementsByName(temp2);
		if(a.length==0)
			break;
		a[0].value = "~NULL";
		b[0].value = "~NULL";
	}
}

function remMin(major,minor){
	table='min'+major;
	var v=document.getElementById(table).rows[minor].cells;
	v[0].style.display = "none";
	v[1].style.display = "none";
	v[2].style.display = "none";
	v[3].style.display = "none";
	v[4].style.display = "none";
	temp = 'minName'+major+minor;
	a=document.getElementsByName(temp);
	temp2 = 'minSco'+major+minor;
	b=document.getElementsByName(temp2);
	a[0].value = "~NULL";
	b[0].value = "~NULL";
}